package edu.groupservice.service;

import edu.groupservice.entity.User;
import edu.groupservice.feign.UserServiceFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 * Created by JPhoebe on 2017-7-8.
 */
@Service
public class UserService {

    @Autowired
    private RestTemplate restTemplate;

    @Autowired
    private UserServiceFeign userServiceFeign;

    public User findUserById(Integer id){

        //使用 restTemplete
        //return this.restTemplate.getForObject("http://UserService/user/"+id,User.class);

        //使用 feign
        return userServiceFeign.findUserById(id);

    }

}
